package service

import (
	mysql "mypro/dao/mysql/user"
	"mypro/models"
	"mypro/utils/snowflake"
)

// 注册
func SignUp(p *models.SignUpRequest) (err error) {
	//雪花算法生成UID
	userID := snowflake.GenID()
	user := &models.User{
		UserID:   userID,
		UserName: p.UserName,
		PassWord: p.PassWord,
	}
	if err := mysql.InsertUser(user); err != nil {
		return err
	}
	return nil
}
